{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 03 控制输入和输出\n",
    "\n",
    "- [03 控制输入和输出](#03-控制输入和输出)\n",
    "  - [总览](#总览)\n",
    "    - [控制输入](#控制输入)\n",
    "      - [常见结构的输入文件](#常见结构的输入文件)\n",
    "        - [输入PDB文件](#输入pdb文件)\n",
    "        - [输入PDB列表](#输入pdb列表)\n",
    "        - [输入Silent文件](#输入silent文件)\n",
    "      - [处理异常残基和水分子](#处理异常残基和水分子)\n",
    "        - [不识别的残基](#不识别的残基)\n",
    "        - [0占有率](#0占有率)\n",
    "      - [通过优化准备结构](#通过优化准备结构)\n",
    "      - [设置输入的搜索路径](#设置输入的搜索路径)\n",
    "      - [更改输入的表示:全原子与质心表示](#更改输入的表示全原子与质心表示)\n",
    "      - [输入已知结构作为比较](#输入已知结构作为比较)\n",
    "      - [输入的其他选项](#输入的其他选项)\n",
    "    - [控制输出](#控制输出)\n",
    "      - [常见结构的输出文件](#常见结构的输出文件)\n",
    "        - [输出为PDB](#输出为pdb)\n",
    "        - [输出为Silent](#输出为silent)\n",
    "        - [从Silent文件提取PDB](#从silent文件提取pdb)\n",
    "        - [输出为压缩文件](#输出为压缩文件)\n",
    "      - [分数文件格式](#分数文件格式)\n",
    "      - [为输出文件添加前后缀](#为输出文件添加前后缀)\n",
    "      - [设置输出路径](#设置输出路径)\n",
    "      - [强制生成/取消输出文件](#强制生成取消输出文件)\n",
    "        - [仅生成分数文件](#仅生成分数文件)\n",
    "      - [调整日志细节等级](#调整日志细节等级)\n",
    "      - [复制rosetta流程的输出](#复制rosetta流程的输出)\n",
    "      - [在Pymol中几乎实时地可视化](#在pymol中几乎实时地可视化)\n",
    "      - [输出的其他选项](#输出的其他选项)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import sys\n",
    "sys.path.append(os.path.abspath('..'))\n",
    "from note_utils.path import chdir, add_rosetta_env\n",
    "\n",
    "rosetta_home=add_rosetta_env('~/git_develop/rosetta') # rosetta主目录路径自行修改\n",
    "tutorial_path=rosetta_home/'demos/tutorials/input_and_output'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "教程目录文件:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "/home/regen/git_develop/rosetta/demos/tutorials/input_and_output:\n",
      "flag_input_relax        flag_relax_interface_constraints  \u001b[0m\u001b[01;34minput_files\u001b[0m/\n",
      "flag_input_relax.short  input_and_output.md               \u001b[01;34moutput_files\u001b[0m/\n",
      "\n",
      "/home/regen/git_develop/rosetta/demos/tutorials/input_and_output/input_files:\n",
      "1qys_10.o  1qys.pdb           1ubq.pdb                   \u001b[01;34mfrom_rcsb\u001b[0m/\n",
      "1qys.cif   1qys_zero_occ.pdb  4eq1.pdb                   pdblist\n",
      "1qys.o     1ubq.cif           constrained_atompairs.cst\n",
      "\n",
      "/home/regen/git_develop/rosetta/demos/tutorials/input_and_output/input_files/from_rcsb:\n",
      "1qys.pdb  2j88.pdb  3tdm.pdb\n",
      "\n",
      "/home/regen/git_develop/rosetta/demos/tutorials/input_and_output/output_files:\n",
      "1qys_silent_scores.sc  \u001b[01;34mexpected_output\u001b[0m/\n",
      "\n",
      "/home/regen/git_develop/rosetta/demos/tutorials/input_and_output/output_files/expected_output:\n",
      "1qys_0001.pdb  1qys_silent_scores.sc  1qys_sorted_scores.sc  score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    %ls -R $tutorial_path"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 总览\n",
    "\n",
    "有多种方式读取输入或者产生输出.教程结束后应当理解:\n",
    "\n",
    "- rosetta支持什么格式\n",
    "- 如何处理导致rosetta崩溃的异常残基和水分子\n",
    "- 如何准备输入结构\n",
    "- 如何要求rosetta与已知结构比较\n",
    "- 如何更改输入输出路径\n",
    "- 如何确保获得连续的运行轨迹\n",
    "- 如何在pymol中可视化结构的更改\n",
    "- 如何覆盖已有的输出\n",
    "\n",
    "本教程涉及多个程序,不会解释过多细节.参看各自的教程以了解该程序的作用.\n",
    "\n",
    "### 控制输入\n",
    "\n",
    "#### 常见结构的输入文件\n",
    "\n",
    "##### 输入PDB文件\n",
    "\n",
    "关于pdb格式的详细说明参见[PDB格式手册](http://www.wwpdb.org/documentation/file-format-content/format33/v3.3.html).\n",
    "\n",
    "rosetta主要关注的行以`ATOM`,`HETATM`,`TER`开始.\n",
    "\n",
    "```pdb\n",
    "...\n",
    "ATOM   1477 3HD2 LEU A  94      10.910  -5.038   7.227  1.00  0.00           H  \n",
    "TER                                                                             \n",
    "HETATM 1479  O   HOH A 107      10.027  -4.206  14.093  1.00  0.00           O \n",
    "...\n",
    "```\n",
    "\n",
    "rosetta识别到上述`ATOM`行记录中表示A链的Leu94残基中的$H_\\delta$原子,三维坐标是(10.910, -5.038, 7.227),占有率为1,温度因子为0.忽略原子编号1477和元素符号H.\n",
    "\n",
    "`TER`标志着链的中断.\n",
    "\n",
    "`HETATM`行记录中的信息与`ATOM`行类似.通常`HETATM`记录的是配体,溶剂,金属离子等的原子信息.\n",
    "\n",
    "rosetta会存储温度因子,但假定所有非零占有率为1.\n",
    "\n",
    "有多个构象的残基,rosetta只记录第一个.\n",
    "\n",
    "传入单个PDB文件,使用`in:file:s`选项加上要传入的文件.\n",
    "\n",
    "例如,计算优化后的1qys.pdb文件的能量:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/1qys.pdb\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-726136205 seed_offset=0 real_seed=-726136205\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=-726136205 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.479007 seconds.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mInstantiate PDBJobInputter\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::fill_jobs\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mpushed input_files/1qys.pdb nstruct index 1\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::pose_from_job\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mfilling pose from PDB input_files/1qys.pdb\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/1qys.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.110949 seconds to load from binary\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0001 reported success in 1 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0mno more batches to process... \n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1 jobs considered, 1 jobs attempted in 1 seconds\n",
      "score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/1qys.pdb # 如果出错,检查程序名后缀\n",
    "    !ls score.sc\n",
    "    !rm score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "第1个命令在命令运行目录产生`score.sc`文件,即1QYS的能量分数.\n",
    "\n",
    "第3个命令移除`score.sc`,如果不移除,后面计算的能量结果均会追加到该文件后.\n",
    "\n",
    "##### 输入PDB列表\n",
    "\n",
    "要输入一组PDB结构文件,使用`in:file:l`选项.PDB列表需要保存在单独的文件中(示例使用的文件名为`pdblist`),作为参数提供给rosetta.\n",
    "\n",
    "PDB列表的格式如下,每行是一个PDB文件的路径;一行内也可以用空格分隔多个文件路径(不建议单个路径中包含空格),逗号或分号不能分隔:\n",
    "\n",
    "```txt\n",
    "input_files/1qys.pdb\n",
    "input_files/1ubq.pdb\n",
    "```\n",
    "\n",
    "示例命令如下:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/score_jd2.default.linuxgccrelease -in:file:l input_files/pdblist\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=2039344192 seed_offset=0 real_seed=2039344192\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=2039344192 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.464659 seconds.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mInstantiate PDBJobInputter\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::fill_jobs\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mpushed input_files/1qys.pdb nstruct index 1\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mpushed input_files/1ubq.pdb nstruct index 1\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::pose_from_job\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mfilling pose from PDB input_files/1qys.pdb\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/1qys.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.103434 seconds to load from binary\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::pose_from_job\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mfilling pose from PDB input_files/1ubq.pdb\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/1ubq.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1ubq_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0mno more batches to process... \n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m2 jobs considered, 2 jobs attempted in 0 seconds\n",
      "score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:l input_files/pdblist\n",
    "    !ls score.sc\n",
    "    !rm score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "同样将生成`score.sc`,第3个命令删除该文件以干净地执行下一步.\n",
    "\n",
    "##### 输入Silent文件\n",
    "\n",
    "Silent文件是Rosetta特有的二进制压缩文件,包含多个结构的信息.\n",
    "\n",
    "当处理过大的输出时,有些文件系统可能出错,Silent格式在此时很有用.\n",
    "\n",
    "slient文件通常由rosetta的各种程序生成,后缀名通常为`.o`.\n",
    "\n",
    "要将Silent文件作为输入,使用`in:file:silent`选项:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/score_jd2.default.linuxgccrelease -in:file:silent input_files/1qys_10.o\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-2025653181 seed_offset=0 real_seed=-2025653181\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=-2025653181 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.466089 seconds.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mcore.io.silent.SilentFileData: \u001b[0mReading all structures from input_files/1qys_10.o\n",
      "\u001b[0mcore.io.silent.SilentFileData: \u001b[0mFinished reading 10 structures from input_files/1qys_10.o\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.100911 seconds to load from binary\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0001_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0002_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0003_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0004_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0005_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0006_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0007_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0008_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0009_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0010_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0mno more batches to process... \n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m10 jobs considered, 10 jobs attempted in 0 seconds\n",
      "score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:silent input_files/1qys_10.o\n",
    "    !ls score.sc\n",
    "    !rm score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "同样将生成`score.sc`,第3个命令删除该文件以干净地执行下一步.\n",
    "\n",
    "`in:file:silent`与`in:file:l`类似,还可以传入silent文件的列表.\n",
    "\n",
    "#### 处理异常残基和水分子\n",
    "\n",
    "大多数rosetta流程假定结构是良好的,例如重原子没有缺失,没有未知的残基名.\n",
    "\n",
    "有时rosetta可以猜测添加哪些原子.例如,给原始的1qys进行打分:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/from_rcsb/1qys.pdb\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-1658139286 seed_offset=0 real_seed=-1658139286\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=-1658139286 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.46981 seconds.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mInstantiate PDBJobInputter\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::fill_jobs\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mpushed input_files/from_rcsb/1qys.pdb nstruct index 1\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::pose_from_job\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mfilling pose from PDB input_files/from_rcsb/1qys.pdb\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/from_rcsb/1qys.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading Selenium SE from MSE as SD from MET\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD1 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD2 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE1 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE2 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OG  on residue SER 25\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE1 on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE2 on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OD1 on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  ND2 on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD1 on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD2 on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH1 on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH2 on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH1 on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH2 on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE1 on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE2 on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue LEU:CtermProteinFull 92\n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 13 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 15 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 25 because of missing atom number 6 atom name  OG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 28 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 29 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 32 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 34 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 44 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 45 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 53 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 60 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 71 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.103519 seconds to load from binary\n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 183 rotamers at 12 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0mno more batches to process... \n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1 jobs considered, 1 jobs attempted in 0 seconds\n",
      "score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/from_rcsb/1qys.pdb\n",
    "    !ls score.sc\n",
    "    !rm score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看到score_jd2尝试将MSE替换为MET,补全缺失的侧链重原子.\n",
    "\n",
    "##### 不识别的残基\n",
    "\n",
    "直接从PDB下载的PDB文件可能无法被rosetta识别,例如解析3TDM将警告`Loading (but possibly not actually using) 'PO4' from the PDB components dictionary for residue type 'pdb_PO4'`,早期版本可能直接报错:`ERROR: Unrecognized residue: PO4`.\n",
    "\n",
    "使用`-ignore_unrecognized_res`选项可以在早期版本直接忽略这些残基.该示例从略.\n",
    "\n",
    "> `-ignore_unrecognized_res`也会忽略水分子,这可能导致结构的能量分数发生改变."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/from_rcsb/3tdm.pdb\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-1427605620 seed_offset=0 real_seed=-1427605620\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=-1427605620 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.465259 seconds.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mInstantiate PDBJobInputter\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::fill_jobs\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mpushed input_files/from_rcsb/3tdm.pdb nstruct index 1\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::pose_from_job\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mfilling pose from PDB input_files/from_rcsb/3tdm.pdb\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/from_rcsb/3tdm.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mLoading (but possibly not actually using) 'PO4' from the PDB components dictionary for residue type 'pdb_PO4'\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue GLY:CtermProteinFull 120\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue PHE:CtermProteinFull 241\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue SER:CtermProteinFull 353\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue PHE:CtermProteinFull 474\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.104747 seconds to load from binary\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m3tdm_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0mno more batches to process... \n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1 jobs considered, 1 jobs attempted in 0 seconds\n",
      "score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/from_rcsb/3tdm.pdb\n",
    "    !ls score.sc\n",
    "    !rm score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 0占有率\n",
    "\n",
    "占有率表示观察到特定构象的比例.大多数原子的占有率为1,观察到有多个构象的残基原子占有率<1.\n",
    "\n",
    "占有率为0的原子表示实验测定中没有观察到该原子,但理论上应该出现.\n",
    "\n",
    "rosetta会忽略占有率为0的原子记录,如果该原子不是骨架重原子,可能会补全侧链;如果是骨架重原子(如N,CA),将删除整个残基.\n",
    "\n",
    "前几个原子占有率被人为调整为0的`1qys_zero_occ.pdb`在打分时将出现`ignoring atom X in residue ...`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/1qys_zero_occ.pdb\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=1114034787 seed_offset=0 real_seed=1114034787\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=1114034787 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.465843 seconds.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mInstantiate PDBJobInputter\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::fill_jobs\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mpushed input_files/1qys_zero_occ.pdb nstruct index 1\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::pose_from_job\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mfilling pose from PDB input_files/1qys_zero_occ.pdb\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/1qys_zero_occ.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m PDB reader is ignoring atom  N   in residue 3 A.  Pass flag -ignore_zero_occupancy false to change this behavior\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m PDB reader is ignoring atom  CA  in residue 3 A.  Pass flag -ignore_zero_occupancy false to change this behavior\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m PDB reader is ignoring atom  C   in residue 3 A.  Pass flag -ignore_zero_occupancy false to change this behavior\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m PDB reader is ignoring atom  O   in residue 3 A.  Pass flag -ignore_zero_occupancy false to change this behavior\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m PDB reader is ignoring atom  CB  in residue 3 A.  Pass flag -ignore_zero_occupancy false to change this behavior\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m skipping pdb residue b/c it's missing too many mainchain atoms:    3 A ASP ASP:NtermProteinFull\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mmissing:  N  \n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mmissing:  CA \n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mmissing:  C  \n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mAdding undetected lower terminus type to residue 2,    4 A\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m discarding 1 atoms at position 2 in file input_files/1qys_zero_occ.pdb. Best match rsd_type:  ILE:NtermProteinFull\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.113088 seconds to load from binary\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_zero_occ_0001 reported success in 0 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0mno more batches to process... \n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1 jobs considered, 1 jobs attempted in 0 seconds\n",
      "score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/1qys_zero_occ.pdb\n",
    "    !ls score.sc\n",
    "    !rm score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "计算的能量比完整的蛋白能量高,因为删除了残基3,相应损失了约3REU分数.\n",
    "\n",
    "有些rosetta应用要求比较的序列长度一致(如`docking_protocol`),可能因为存在0占有率的原子而中途崩溃.\n",
    "\n",
    "`-ignore_zero_occupancy`选项默认值为true,为解决该问题,`-ignore_zero_occupancy false`选项将强制读取0占有率的原子.\n",
    "\n",
    "以该选项计算能量,应该与最开始的能量分数一致.该示例从略.\n",
    "\n",
    "#### 通过优化准备结构\n",
    "\n",
    "在使用其他rosetta应用前,使用`relax`流程优化蛋白结构是推荐的方式.参见[`relax`教程](10_relax_structures.md).\n",
    "\n",
    "我们期望释放输入结构中的不良接触,但不希望骨架移动距离太大.一个通用的驰豫选项为:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "-nstruct 2\n",
      "\n",
      "-relax:constrain_relax_to_start_coords\n",
      "-relax:ramp_constraints false\n",
      "\n",
      "-ex1\n",
      "-ex2\n",
      "\n",
      "-use_input_sc\n",
      "-flip_HNQ\n",
      "-no_optH false\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    %cat flag_input_relax"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`nstruct`选项数值更高,优化次数更多,可能产生更好的结果,但也会消耗大量时间.\n",
    "\n",
    "使用该选项文件优化PDB数据库的1qys文件结构,可能耗费几分钟:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/relax.default.linuxgccrelease -in:file:s input_files/from_rcsb/1qys.pdb @flag_input_relax\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-1649966601 seed_offset=0 real_seed=-1649966601\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=-1649966601 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.467172 seconds.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mReading relax scripts list from database.\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mLooking for MonomerRelax2019.txt\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0m================== Reading script file: /home/regen/git_develop/rosetta/database/sampling/relax_scripts/MonomerRelax2019.txt ==================\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepeat %%nrepeats%%\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mcoord_cst_weight 1.0\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.040\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepack\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.051\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mmin 0.01\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mcoord_cst_weight 0.5\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.265\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepack\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.280\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mmin 0.01\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mcoord_cst_weight 0.0\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.559\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepack\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 0.581\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mmin 0.01\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mcoord_cst_weight 0.0\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mscale:fa_rep 1\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mrepack\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mmin 0.00001\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0maccept_to_best\n",
      "\u001b[0mprotocols.relax.RelaxScriptManager: \u001b[0mendrepeat\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mInstantiate PDBJobInputter\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::fill_jobs\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mpushed input_files/from_rcsb/1qys.pdb nstruct indices 1 - 2\n",
      "\u001b[0mprotocols.evaluation.ChiWellRmsdEvaluatorCreator: \u001b[0mEvaluation Creator active ... \n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::pose_from_job\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mfilling pose from PDB input_files/from_rcsb/1qys.pdb\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/from_rcsb/1qys.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading Selenium SE from MSE as SD from MET\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD1 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD2 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE1 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE2 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OG  on residue SER 25\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE1 on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE2 on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OD1 on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  ND2 on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD1 on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD2 on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH1 on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH2 on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH1 on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH2 on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE1 on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE2 on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue LEU:CtermProteinFull 92\n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 13 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 15 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 25 because of missing atom number 6 atom name  OG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 28 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 29 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 32 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 34 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 44 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 45 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 53 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 60 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 71 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.108675 seconds to load from binary\n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 200 rotamers at 12 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 294 rotamers at 92 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mcore.io.pdb.file_data: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m OPT-H: heavyatom chi angle change: chidev=   180.000 chino=  3 position:    3 GLN GLN\n",
      "\u001b[0mcore.io.pdb.file_data: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m OPT-H: heavyatom chi angle change: chidev=   180.000 chino=  2 position:    7 ASN ASN\n",
      "\u001b[0mcore.io.pdb.file_data: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m OPT-H: heavyatom chi angle change: chidev=   180.000 chino=  2 position:   14 ASN ASN\n",
      "\u001b[0mcore.io.pdb.file_data: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m OPT-H: heavyatom chi angle change: chidev=   180.000 chino=  3 position:   41 GLN GLN\n",
      "\u001b[0mcore.io.pdb.file_data: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m OPT-H: heavyatom chi angle change: chidev=   180.000 chino=  2 position:   78 ASN ASN\n",
      "\u001b[0mcore.io.pdb.file_data: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m OPT-H: heavyatom chi angle change: chidev=   180.000 chino=  3 position:   91 GLN GLN\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repeat  176.978  0  0  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  176.978  0  0  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -21.8218  0  0  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2637 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -225.569  0  0  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -219.67  0  0  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -311.44  0.181109  0.181109  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -311.44  0.181109  0.181109  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -244.163  0.181109  0.181109  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2486 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -259.35  0.181109  0.181109  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -256.117  0.181109  0.181109  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -282.504  0.163141  0.163141  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -282.504  0.163141  0.163141  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -249.966  0.163141  0.163141  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2465 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -250.594  0.163141  0.163141  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -248.203  0.163141  0.163141  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -254.309  0.155381  0.155381  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -254.309  0.155381  0.155381  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -218.118  0.155381  0.155381  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2176 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -218.187  0.155381  0.155381  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -236.326  0.164365  0.164365  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 0  -236.326  -236.326  0.164365  0.164365  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -236.326  0.164365  0.164365  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -236.326  0.164365  0.164365  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -236.326  0.164365  0.164365  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -295.491  0.164365  0.164365  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2350 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -303.303  0.164365  0.164365  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -301.788  0.164365  0.164365  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -324.987  0.184083  0.184083  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -324.987  0.184083  0.184083  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -277.297  0.184083  0.184083  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2610 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -282.289  0.184083  0.184083  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -279.705  0.184083  0.184083  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -289.674  0.170445  0.170445  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -289.674  0.170445  0.170445  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -257.828  0.170445  0.170445  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2497 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -258.788  0.170445  0.170445  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -256.423  0.170445  0.170445  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -265.286  0.161687  0.161687  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -265.286  0.161687  0.161687  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -231.752  0.161687  0.161687  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2181 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -231.941  0.161687  0.161687  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -240.047  0.163771  0.163771  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 1  -240.047  -240.047  0.163771  0.163771  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -240.047  0.163771  0.163771  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -240.047  0.163771  0.163771  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -240.047  0.163771  0.163771  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -300.422  0.163771  0.163771  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2363 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -307.252  0.163771  0.163771  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -305.849  0.163771  0.163771  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -324.689  0.187373  0.187373  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -324.689  0.187373  0.187373  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -278.409  0.187373  0.187373  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2633 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -284.004  0.187373  0.187373  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -281.508  0.187373  0.187373  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -292.292  0.16864  0.16864  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -292.292  0.16864  0.16864  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -263.312  0.16864  0.16864  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2491 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -263.725  0.16864  0.16864  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -261.543  0.16864  0.16864  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -265.5  0.163302  0.163302  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -265.5  0.163302  0.163302  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -230.824  0.163302  0.163302  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2197 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -230.98  0.163302  0.163302  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -240.012  0.16368  0.16368  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 2  -240.012  -240.047  0.163771  0.163771  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -240.012  0.16368  0.16368  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -240.012  0.16368  0.16368  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -240.012  0.16368  0.16368  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -300.766  0.16368  0.16368  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2363 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -306.398  0.16368  0.16368  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -305.078  0.16368  0.16368  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -323.13  0.187329  0.187329  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -323.13  0.187329  0.187329  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -278.21  0.187329  0.187329  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2583 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -284.102  0.187329  0.187329  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -281.717  0.187329  0.187329  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -292.255  0.166162  0.166162  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -292.255  0.166162  0.166162  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -262.14  0.166162  0.166162  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2499 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -262.883  0.166162  0.166162  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -260.641  0.166162  0.166162  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -265.334  0.163205  0.163205  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -265.334  0.163205  0.163205  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -231.537  0.163205  0.163205  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2422 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -231.784  0.163205  0.163205  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -240.13  0.163703  0.163703  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 3  -240.13  -240.13  0.163703  0.163703  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -240.13  0.163703  0.163703  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -240.13  0.163703  0.163703  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -240.13  0.163703  0.163703  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -300.561  0.163703  0.163703  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2360 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -307.376  0.163703  0.163703  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -305.984  0.163703  0.163703  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -325.557  0.179484  0.179484  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -325.557  0.179484  0.179484  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -280.527  0.179484  0.179484  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2586 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -285.742  0.179484  0.179484  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -283.37  0.179484  0.179484  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -293.015  0.167394  0.167394  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -293.015  0.167394  0.167394  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -263.16  0.167394  0.167394  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2493 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -263.573  0.167394  0.167394  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -261.363  0.167394  0.167394  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -265.242  0.163769  0.163769  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -265.242  0.163769  0.163769  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -231.048  0.163769  0.163769  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2442 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -231.294  0.163769  0.163769  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -240.435  0.165366  0.165366  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 4  -240.435  -240.435  0.165366  0.165366  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -240.435  0.165366  0.165366  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -240.435  0.165366  0.165366  0.55\n",
      "\u001b[0mprotocols::checkpoint: \u001b[0mDeleting checkpoints of FastRelax\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0001 reported success in 32 seconds\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mPDBJobInputter::pose_from_job\n",
      "\u001b[0mprotocols.jd2.PDBJobInputter: \u001b[0mfilling pose from saved copy input_files/from_rcsb/1qys.pdb\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repeat  176.978  0  0  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  176.978  0  0  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -21.8218  0  0  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2637 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -225.862  0  0  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -219.159  0  0  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -314.609  0.175118  0.175118  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -314.609  0.175118  0.175118  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -242.629  0.175118  0.175118  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2581 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -259.241  0.175118  0.175118  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -255.856  0.175118  0.175118  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -285.933  0.163302  0.163302  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -285.933  0.163302  0.163302  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -253.808  0.163302  0.163302  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2465 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -254.844  0.163302  0.163302  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -252.441  0.163302  0.163302  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -257.005  0.156628  0.156628  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -257.005  0.156628  0.156628  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -220.023  0.156628  0.156628  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2167 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -220.437  0.156628  0.156628  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -234.377  0.16101  0.16101  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 0  -234.377  -234.377  0.16101  0.16101  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -234.377  0.16101  0.16101  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -234.377  0.16101  0.16101  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -234.377  0.16101  0.16101  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -294.111  0.16101  0.16101  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2354 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -303.64  0.16101  0.16101  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -301.389  0.16101  0.16101  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -323.002  0.18552  0.18552  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -323.002  0.18552  0.18552  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -268.141  0.18552  0.18552  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2631 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -276.787  0.18552  0.18552  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -274.043  0.18552  0.18552  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -289.92  0.1652  0.1652  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -289.92  0.1652  0.1652  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -258.74  0.1652  0.1652  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2500 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -259.399  0.1652  0.1652  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -257.016  0.1652  0.1652  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -263.165  0.160729  0.160729  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -263.165  0.160729  0.160729  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -229.002  0.160729  0.160729  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2175 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -229.128  0.160729  0.160729  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -238.915  0.163969  0.163969  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 1  -238.915  -238.915  0.163969  0.163969  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -238.915  0.163969  0.163969  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -238.915  0.163969  0.163969  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -238.915  0.163969  0.163969  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -299.956  0.163969  0.163969  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2365 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -306.157  0.163969  0.163969  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -303.992  0.163969  0.163969  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -329.389  0.183789  0.183789  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -329.389  0.183789  0.183789  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -275.276  0.183789  0.183789  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2578 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -280.937  0.183789  0.183789  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -278.176  0.183789  0.183789  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -291.062  0.165917  0.165917  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -291.062  0.165917  0.165917  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -258.649  0.165917  0.165917  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2512 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -259.308  0.165917  0.165917  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -256.838  0.165917  0.165917  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -264.511  0.161211  0.161211  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -264.511  0.161211  0.161211  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -230.39  0.161211  0.161211  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2213 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -230.538  0.161211  0.161211  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -238.933  0.164026  0.164026  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 2  -238.933  -238.933  0.164026  0.164026  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -238.933  0.164026  0.164026  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -238.933  0.164026  0.164026  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -238.933  0.164026  0.164026  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -299.572  0.164026  0.164026  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2648 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -306.319  0.164026  0.164026  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -304.136  0.164026  0.164026  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -327.82  0.183838  0.183838  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -327.82  0.183838  0.183838  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -275.454  0.183838  0.183838  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2587 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -281.537  0.183838  0.183838  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -278.921  0.183838  0.183838  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -288.559  0.171991  0.171991  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -288.559  0.171991  0.171991  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -254.957  0.171991  0.171991  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2501 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -256.056  0.171991  0.171991  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -253.638  0.171991  0.171991  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -263.44  0.165345  0.165345  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -263.44  0.165345  0.165345  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -229.035  0.165345  0.165345  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2448 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -228.556  0.165345  0.165345  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -238.794  0.164694  0.164694  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 3  -238.794  -238.933  0.164026  0.164026  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -238.794  0.164694  0.164694  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -238.794  0.164694  0.164694  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -238.794  0.164694  0.164694  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -299.821  0.164694  0.164694  0.022\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2362 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -306.295  0.164694  0.164694  0.022\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -304.896  0.164694  0.164694  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -322.921  0.187962  0.187962  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -322.921  0.187962  0.187962  0.02805\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -276.711  0.187962  0.187962  0.14575\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2579 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -282.879  0.187962  0.187962  0.14575\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -280.387  0.187962  0.187962  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -291.42  0.168069  0.168069  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -291.42  0.168069  0.168069  0.154\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -261.099  0.168069  0.168069  0.30745\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2522 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -261.719  0.168069  0.168069  0.30745\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -259.424  0.168069  0.168069  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -264.674  0.162856  0.162856  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: coord_cst_weight  -264.674  0.162856  0.162856  0.31955\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: scale:fa_rep  -229.629  0.162856  0.162856  0.55\n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 2439 rotamers at 93 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: repack  -229.63  0.162856  0.162856  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: min  -238.748  0.164247  0.164247  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mMRP: 4  -238.748  -238.933  0.164026  0.164026  \n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: accept_to_best  -238.748  0.164247  0.164247  0.55\n",
      "\u001b[0mprotocols.relax.FastRelax: \u001b[0mCMD: endrepeat  -238.748  0.164247  0.164247  0.55\n",
      "\u001b[0mprotocols::checkpoint: \u001b[0mDeleting checkpoints of FastRelax\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m1qys_0002 reported success in 34 seconds\n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0mno more batches to process... \n",
      "\u001b[0mprotocols.jd2.JobDistributor: \u001b[0m2 jobs considered, 2 jobs attempted in 66 seconds\n",
      "\u001b[0mbasic.citation_manager.CitationManager: \u001b[0m\u001b[44m\u001b[37m\u001b[1m\u001b[4m\n",
      "The following Rosetta modules were used during this run of Rosetta, and should be cited:\n",
      "\n",
      "\u001b[0m\u001b[44m\u001b[37mFastRelax Mover's citation(s):\n",
      "*Tyka MD, *Keedy DA, André I, Dimaio F, Song Y, Richardson DC, Richardson JS, and Baker D.  (2011).  Alternate states of proteins revealed by detailed energy landscape mapping.  J Mol Biol 405(2):607-18.  doi: 10.1016/j.jmb.2010.11.008.  (*Co-primary authors.)\n",
      "\n",
      "Khatib F, Cooper S, Tyka MD, Xu K, Makedon I, Popovic Z, Baker D, and Players F.  (2011).  Algorithm discovery by protein folding game players.  Proc Natl Acad Sci USA 108(47):18949-53.  doi: 10.1073/pnas.1115898108.\n",
      "\n",
      "Maguire JB, Haddox HK, Strickland D, Halabiya SF, Coventry B, Griffin JR, Pulavarti SVSRK, Cummins M, Thieker DF, Klavins E, Szyperski T, DiMaio F, Baker D, and Kuhlman B.  (2021).  Perturbing the energy landscape for improved packing during computational protein design.  Proteins 89(4):436-449.  doi: 10.1002/prot.26030.\n",
      "\n",
      "\u001b[0m\n",
      "1qys_0001.pdb  1qys_0002.pdb  score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/relax.default.linuxgccrelease -in:file:s input_files/from_rcsb/1qys.pdb @flag_input_relax\n",
    "    !ls 1qys_0001.pdb 1qys_0002.pdb score.sc\n",
    "    !rm 1qys_0001.pdb 1qys_0002.pdb score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将生成`1qys_0001.pdb`, `1qys_0002.pdb`与`score.sc`.选择sc文件中`total_score`更低的pdb文件作为后续流程的输入.\n",
    "\n",
    "> 以上选项如有需要,可以结合`-ignore_unrecognized_res`和`-ignore_zero_occupany false`.  \n",
    "> `-ignore_unrecognized_res`可能会移除你想纳入计算的配体和水分子.  \n",
    "> 确保你想要建模的残基都在优化的PDB中.\n",
    "\n",
    "#### 设置输入的搜索路径\n",
    "\n",
    "可以指定命令搜索输入的路径.例如当前处于`input_and_output`目录,而原始结构,约束文件`constrained_atompairs.cst`都在子目录`input_files`中,使用`-in:path`选项可以指定输入的搜索路径:\n",
    "\n",
    "> 下列命令需要约15min,不实际运行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/relax.default.linuxgccrelease -in:path input_files -in:file:s 4eq1.pdb -constraints:cst_fa_file constrained_atompairs.cst -ignore_unrecognized_res @flag_input_relax\n",
    "    !ls 4eq1_0001.pdb 4eq1_0002.pdb score.sc\n",
    "    !rm 4eq1_0001.pdb 4eq1_0002.pdb score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 更改输入的表示:全原子与质心表示\n",
    "\n",
    "rosetta支持完整的全原子表示和粗粒度的质心表示方式.\n",
    "\n",
    "详细区别参见[全原子表示vs质心表示](07_full_atom_vs_centroid_representations.md).`-in:file:fullatom`和`-in:file:centroid`选项确保rosetta正确认识输入文件的表示方式.在上述教程中有详细的示例.\n",
    "\n",
    "#### 输入已知结构作为比较\n",
    "\n",
    "将rosetta预测的结果与已知(原生)结构比较是常见的需求,对于基准测试特别有用;也可以检查rosetta更改修改pdb的程度.使用`-in:file:native`选项以指定原生结构.例如:要给优化过的1qys进行打分,并计算与PDB数据库中原生结构的差异:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/score.default.linuxgccrelease -in:file:s input_files/1qys.pdb -in:file:native input_files/from_rcsb/1qys.pdb -ignore_waters\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=547422952 seed_offset=0 real_seed=547422952\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=547422952 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\n",
      "\n",
      "\n",
      " Rosetta Tool:   score   -  rescores PDBs and silent files, extracts PDBs from silent files, assembles PDBs into silent files. \n",
      " Usage:                                                                  \n",
      "   PDB input:      -in:file:s *.pdb   or  \n",
      "                   -in:file:l  list_of_pdbs  \n",
      "                   -no_optH                                    Dont change positions of Hydrogen atoms! (default true, specify false if you want optH)\n",
      "   Silent input:   -in:file:silent silent.out                  silent input filesname \n",
      "                   -in:file:tags                               specify specific tags to be extracted, if left out all will be taken \n",
      "                   -in:file:fullatom                           for full atom structures \n",
      "                   -in:file:binary_silentfile                  for non-ideal structures (such as from looprelax) \n",
      "                   -in:file:silent_optH                        Call optH when reading silent files (useful for HisD/HisE determination)\n",
      "                   -score_app:linmin                           Run a quick linmin before scoring\n",
      "   Native:         -in:file:native                             native PDB (rms, maxsub and gdtm scores will be calculated)\n",
      "   Scorefunction:  -score:weights  weights                     weight set or weights file \n",
      "                   -score:patch  patch                         patch set \n",
      "                   -score:optH_weights                         Weights file for optH (default standard.wts w/ sc12 patch)\n",
      "                   -score:optH_patch                           Weights patch file for optH\n",
      "                   -rescore:verbose                            display score breakdown \n",
      "   Output:         -out:nooutput                               don't print PDB structures (default now) \n",
      "                   -out:output                                 force printing of PDB structures \n",
      "                   -out:file:silent                            write silent-out file \n",
      "                   -out:file:scorefile name                    write scorefile (default default.sc)\n",
      "                   -out:prefix  myprefix                       prefix the output structures with a string \n",
      "  Examples: \n",
      "   score  -database ~/minirosetta_database -in:file:silent silent.out -in::file::binary_silentfile -in::file::fullatom -native 1a19.pdb \n",
      "   Will rescore all structures in silent.out, in full atom mode and accounting for nonideal structure if present. Additionally \n",
      "   it will print a PDB for every structure with -out:output flag \n",
      "\n",
      "\n",
      "\n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n",
      "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.463249 seconds.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n",
      "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/from_rcsb/1qys.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading Selenium SE from MSE as SD from MET\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD1 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD2 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE1 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE2 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OG  on residue SER 25\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE1 on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE2 on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OD1 on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  ND2 on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD1 on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD2 on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH1 on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH2 on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH1 on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH2 on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE1 on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE2 on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue LEU:CtermProteinFull 92\n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 13 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 15 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 25 because of missing atom number 6 atom name  OG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 28 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 29 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 32 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 34 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 44 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 45 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 53 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 60 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 71 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n",
      "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/home/regen/git_develop/rosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n",
      "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.10008 seconds to load from binary\n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 183 rotamers at 12 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.jobdist.main: \u001b[0mPDB Output Mode \n",
      "\u001b[0mprotocols.jobdist.JobDistributors: \u001b[0mLooking for an available job: 1 1 input_files/1qys.pdb 1\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/from_rcsb/1qys.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading Selenium SE from MSE as SD from MET\n",
      "\u001b[0mcore.io.pose_from_sfr.PoseFromSFRBuilder: \u001b[0mReading MSE as MET!\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 13\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD1 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD2 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE1 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE2 on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue PHE 15\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OG  on residue SER 25\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE1 on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE2 on residue GLN 28\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 29\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OD1 on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  ND2 on residue ASN 32\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD1 on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD2 on residue LEU 34\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 44\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH1 on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH2 on residue ARG 45\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NE  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CZ  on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH1 on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NH2 on residue ARG 53\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CE  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  NZ  on residue LYS 60\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CG  on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  CD  on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE1 on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OE2 on residue GLU 71\n",
      "\u001b[0mcore.conformation.Conformation: \u001b[0m\u001b[1m[ WARNING ]\u001b[0m missing heavyatom:  OXT on residue LEU:CtermProteinFull 92\n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 13 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 15 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 25 because of missing atom number 6 atom name  OG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 28 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 29 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 32 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 34 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 44 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 45 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 53 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 60 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.pack_missing_sidechains: \u001b[0mpacking residue number 71 because of missing atom number 6 atom name  CG \n",
      "\u001b[0mcore.pack.task: \u001b[0mPacker task: initialize from command line() \n",
      "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n",
      "\u001b[0mcore.pack.pack_rotamers: \u001b[0mbuilt 183 rotamers at 12 positions.\n",
      "\u001b[0mcore.pack.interaction_graph.interaction_graph_factory: \u001b[0mInstantiating DensePDInteractionGraph\n",
      "\u001b[0mprotocols.jobdist.main: \u001b[0mStarting 1qys_0001 ...\n",
      "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile 'input_files/1qys.pdb' automatically determined to be of type PDB\n",
      "\u001b[0mprotocols.jobdist.main: \u001b[0mFinished 1qys_0001 in 0 seconds.\n",
      "\u001b[0mprotocols.jobdist.main: \u001b[0mFinished all 1 structures in 0 seconds.\n",
      "SCORE:     score     fa_atr     fa_rep     fa_sol    fa_intra_rep    fa_intra_sol_xover4    lk_ball_wtd    fa_elec    pro_close    hbond_sr_bb    hbond_lr_bb    hbond_bb_sc    hbond_sc    dslf_fa13      omega     fa_dun    p_aa_pp    yhh_planarity        ref    rama_prepro    allatom_rms    gdtmm    gdtmm1_1    gdtmm2_2    gdtmm3_3    gdtmm4_3    gdtmm7_4    irms    maxsub    maxsub2.0    rms description\n",
      "SCORE:  -224.872   -501.794     71.043    304.630           1.118                 18.786         -6.481   -146.069        0.000        -33.177        -35.139         -5.915     -18.005        0.000      3.494    104.484    -13.948            0.230     24.518          7.351          1.040    1.000       1.000       1.000       1.000       1.000       1.000   0.000    92.000       92.000  0.135   1qys_0001\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score.default.linuxgccrelease -in:file:s input_files/1qys.pdb -in:file:native input_files/from_rcsb/1qys.pdb -ignore_waters\n",
    "    !cat default.sc\n",
    "    !rm default.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在生成的`default.sc`中,`allatom_rms`表示与原生结构的全原子RMSD,为1.0xx.因为rosetta在优化结构期间释放了不良冲突.\n",
    "\n",
    "`rms`计算的是CA RMSD,约0.135,明显低于全原子RMSD,因为没有对骨架做过多移动.也有其他整体距离度量指标.\n",
    "\n",
    "> 原生结构和比对结构的残基数,残基编号,链编号必须一致,否则将导致错误.  \n",
    "> rosetta会重新构建丢失过多重原子的残基侧链,因此每次计算,结果可能略有不同.  \n",
    "\n",
    "#### 输入的其他选项\n",
    "\n",
    "参见[完整选项列表](../01protocols/00_full_options_list.md).\n",
    "\n",
    "### 控制输出\n",
    "\n",
    "#### 常见结构的输出文件\n",
    "\n",
    "rosetta主要使用2种输出结构:PDB和Silent格式.\n",
    "\n",
    "##### 输出为PDB\n",
    "\n",
    "PDB是rosetta的默认输出格式.有些应用默认不输出结构文件(如打分应用),`-out:pdb`选项强制输出pdb格式.\n",
    "\n",
    "##### 输出为Silent\n",
    "\n",
    "`-out:file:silent <文件名>`选项更改输出格式为silent格式.silent文件可以存储多个结构,因此只需要指定一个输出文件名.例如之前的驰豫命令:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with chdir(tutorial_path):#(输出与之前的命令类似,不执行)\n",
    "    !$ROSETTA3/bin/relax.default.linuxgccrelease -in:file:s input_files/from_rcsb/1qys.pdb -out:file:silent output_files/1qys.o @flag_input_relax\n",
    "    !ls output_files/1qys.o\n",
    "    !rm output_files/1qys.o"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 从Silent文件提取PDB\n",
    "\n",
    "要从silent文件中提取PDB结构,使用"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "以`input_and_output/input_files/1qys.o`为例,包含10个结构,假设要提取能量前3的pdb结构.\n",
    "\n",
    "首先将分数行提取到单独的sc文件中,并按分数顺序排列,最后一列保存到tag文件中:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "SCORE:     score     fa_atr     fa_rep     fa_sol    fa_intra_rep    fa_elec    pro_close    hbond_sr_bb    hbond_lr_bb    hbond_bb_sc    hbond_sc    dslf_fa13    coordinate_constraint       rama      omega     fa_dun    p_aa_pp    yhh_planarity        ref       time description\n",
      "SCORE:  -145.658   -416.906     48.038    235.048           1.023    -47.764        0.000        -25.252        -27.431         -4.739     -10.754        0.000                   19.154     -4.561      4.169    110.657    -13.935            0.237    -12.643    121.000   1qys_0001\n",
      "SCORE:  -145.660   -420.838     48.025    238.756           1.060    -46.720        0.000        -25.165        -27.016         -4.015     -11.516        0.000                   19.184     -4.853      4.610    108.629    -13.397            0.240    -12.643    119.000   1qys_0002\n",
      "SCORE:  -147.668   -414.585     46.523    235.308           1.033    -48.171        0.000        -25.516        -27.189         -3.772     -11.903        0.000                   18.993     -4.991      4.809    108.061    -13.796            0.171    -12.643    115.000   1qys_0003\n",
      "\n",
      "1qys_0007\n",
      "1qys_0005\n",
      "1qys_0009\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !grep '^SCORE' input_files/1qys_10.o > output_files/1qys_silent_scores.sc # 提取带SCORE的行\n",
    "    !head -n 4 output_files/1qys_silent_scores.sc # 显示前4行,最后一列`description`包含文件标签\n",
    "    !echo \n",
    "    !sort -k1,1 -k2n output_files/1qys_silent_scores.sc | head -n 3 | awk '{print $NF}' - > input_files/1qys_top3.tag  # 按score列排序,显示前3行,分割最后一列\n",
    "    !cat input_files/1qys_top3.tag # 显示生成的tag文件"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将生成的tag文件作为`in:file:tagfile`的参数,用`extract_pdbs`程序生成想要的结果:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "********  (C) Copyright Rosetta Commons Member Institutions.  ***************\n",
      "* Use of Rosetta for commercial purposes may require purchase of a license. *\n",
      "********  See LICENSE.md or email license@uw.edu for more details. **********\n",
      "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags \n",
      "\u001b[0mcore.init: \u001b[0mRosetta version: 2024.38+main.200d5f9a7d 200d5f9a7d8cdd7afdd078f156da6b5a7d97543f https://github.com/RosettaCommons/rosetta.git 2024-09-11T17:31:36\n",
      "\u001b[0mcore.init: \u001b[0mRosetta extras: []\n",
      "\u001b[0mcore.init: \u001b[0mcommand: /home/regen/git_develop/rosetta/source/bin/extract_pdbs.default.linuxgccrelease -in:file:silent input_files/1qys_10.o -in:file:tagfile input_files/1qys_top3.tag\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-1675757858 seed_offset=0 real_seed=-1675757858\n",
      "\u001b[0mbasic.random.init_random_generator: \u001b[0mRandomGenerator:init: Normal mode, seed=-1675757858 RG_type=mt19937\n",
      "\u001b[0mcore.init: \u001b[0mfound database environment variable ROSETTA3_DB: /home/regen/git_develop/rosetta/database\n",
      "\u001b[0mcore.io.silent.SilentFileData: \u001b[0mReading 3 structures from input_files/1qys_10.o\n",
      "\u001b[0mcore.io.silent.SilentFileData: \u001b[0mFinished reading 3 structures from input_files/1qys_10.o\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set.  Created 985 residue types\n",
      "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 0.46845 seconds.\n",
      "\u001b[0mextract_pdbs: \u001b[0mextracting Pose with tag 1qys_0005 into PDB file 1qys_0005.pdb\n",
      "\u001b[0mextract_pdbs: \u001b[0mextracting Pose with tag 1qys_0007 into PDB file 1qys_0007.pdb\n",
      "\u001b[0mextract_pdbs: \u001b[0mextracting Pose with tag 1qys_0009 into PDB file 1qys_0009.pdb\n",
      "\n",
      "1qys_0005.pdb  1qys_0007.pdb  1qys_0009.pdb\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/extract_pdbs.default.linuxgccrelease -in:file:silent input_files/1qys_10.o -in:file:tagfile input_files/1qys_top3.tag \n",
    "    !echo\n",
    "    !ls 1qys_0007.pdb  1qys_0005.pdb  1qys_0009.pdb\n",
    "    !rm 1qys_0007.pdb  1qys_0005.pdb  1qys_0009.pdb input_files/1qys_top3.tag "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 输出为压缩文件\n",
    "\n",
    "rosetta程序支持将输出的pdb保存为gz压缩格式.\n",
    "\n",
    "使用`-out:pdb_gz`而非`-out:pdb`产生压缩的pdb格式.\n",
    "\n",
    "使用`-out:file:silent`并给输出文件名增加`.gz`后缀会将silent文件压缩为gz格式.\n",
    "\n",
    "#### 分数文件格式\n",
    "\n",
    "分数文件格式支持csv(分隔符为空格)和json格式.默认生成csv格式.\n",
    "\n",
    "要生成json格式,使用`-out:file:scorefile_format json`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "{\"decoy\":\"1qys_0001\",\"dslf_fa13\":0.0,\"fa_atr\":-501.7941638171753,\"fa_dun\":104.4840177088977,\"fa_elec\":-146.0688112524114,\"fa_intra_rep\":1.118292843079821,\"fa_intra_sol_xover4\":18.78604439450423,\"fa_rep\":71.04290467457577,\"fa_sol\":304.6300879733749,\"hbond_bb_sc\":-5.914636145135261,\"hbond_lr_bb\":-35.13874437180655,\"hbond_sc\":-18.0049636587651,\"hbond_sr_bb\":-33.1771841529872,\"linear_chainbreak\":0.0,\"lk_ball_wtd\":-6.480549308000048,\"omega\":3.494373086482962,\"overlap_chainbreak\":0.0,\"p_aa_pp\":-13.9480902471856,\"pro_close\":0.0,\"rama_prepro\":7.35085329936947,\"ref\":24.51825,\"score\":-224.8720855712891,\"time\":0.0,\"total_score\":-224.8720812364957,\"yhh_planarity\":0.2302377366858935}\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/1qys.pdb -out:file:scorefile_format json > /dev/null # 输出类似,禁用输出\n",
    "    !cat score.sc\n",
    "    !rm score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 为输出文件添加前后缀\n",
    "\n",
    "默认使用输入结构的文件名以及数字后缀(_0001, _0002等)作为输出结构的文件名.\n",
    "\n",
    "使用`-out:prefix 前缀字符串`,`-out:suffix 后缀字符串`分别增加前缀和后缀,结构文件依然会添加数字后缀."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "pre_1qys_suf_0001.pdb  pre_score_suf.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/1qys.pdb -out:pdb -out:prefix pre_ -out:suffix _suf > /dev/null # 输出类似,禁用输出\n",
    "    !ls pre*\n",
    "    !rm pre_*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 设置输出路径\n",
    "\n",
    "默认将打分文件和输出结构文件存放在当前工作目录.\n",
    "\n",
    "使用`-out:path:all`切换存放的位置,例如保存到`output_files`文件夹下:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "output_files/1qys_0001.pdb  output_files/score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/1qys.pdb -out:pdb -out:path:all output_files > /dev/null # 输出类似,禁用输出\n",
    "    !ls output_files/1qys_0001.pdb output_files/score.sc\n",
    "    !rm output_files/1qys_0001.pdb output_files/score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "要将打分文件和输出结构分别指定存放位置,可以使用`-out:path:score`和`-out:path:pdb`选项.\n",
    "\n",
    "#### 强制生成/禁止输出文件\n",
    "\n",
    "`score_jd2`可以使用`-out:pdb`强制生成pdb结构文件,见上文.\n",
    "\n",
    "`-out:nooutput`可以禁止生成输出.特别适合只想要检查日志,不需要输出的情况.\n",
    "\n",
    "某些特定流程直接输出非结构/非分数文件,该选项可能也有用.\n",
    "\n",
    "如果只想禁用部分输出,例如禁用分数文件,强制生成pdb文件,可以设置分数文件的输出路径为unix系统上的`/dev/null`设备:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "ls: 无法访问 'score.sc': 没有那个文件或目录\n",
      "1qys_0001.pdb\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/score_jd2.default.linuxgccrelease -in:file:s input_files/1qys.pdb -out:pdb -out:path:score /dev/null  > /dev/null # 输出类似,禁用输出\n",
    "    !ls 1qys_0001.pdb score.sc\n",
    "    !rm 1qys_0001.pdb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 仅生成分数文件\n",
    "\n",
    "`-out:file:score_only 分数文件名`可以只生成分数文件.例如驰豫命令仅输出分数文件:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "ls: 无法访问 'output_files/1qys_000*.pdb': 没有那个文件或目录\n",
      " output_files/score.sc\n",
      "rm: 无法删除 'output_files/1qys_000*.pdb': 没有那个文件或目录\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/relax.default.linuxgccrelease -in:file:s input_files/1qys.pdb -out:file:score_only output_files/score.sc @flag_input_relax > /dev/null # 输出类似,禁用输出\n",
    "    !ls output_files/1qys_000*.pdb output_files/score.sc\n",
    "    !rm output_files/1qys_000*.pdb output_files/score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 调整日志细节等级\n",
    "\n",
    "有时在出现问题时,你想要更多输出;有时你想要更少输出.\n",
    "\n",
    "`-out:level 日志等级`以控制输出的详细程度.\n",
    "\n",
    "|整数|等级|\n",
    "|-|-|\n",
    "|0|致命错误|\n",
    "|100|错误|\n",
    "|200|警告|\n",
    "|300|基本信息|\n",
    "|400|调试信息|\n",
    "|500|追溯信息|\n",
    "\n",
    "默认等级为300基本信息.数字越大,信息越多.\n",
    "\n",
    "#### 重现rosetta流程的输出\n",
    "\n",
    "许多流程使用蒙特卡罗采样.虽然随机采样方法加速了能量最小化搜索过程,但每次生成的轨迹是不同的.\n",
    "\n",
    "默认使用`/dev/urandom`系统设备生成伪随机数种子;种子可以是C++ int数据类型支持的整数,推荐的范围为$\\pm 10^6-10^9$.在运行过程中会在日志中显示:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "basic.random.init_random_generator: 'RNG device' seed mode, using '/dev/urandom', seed=-207737814 seed_offset=0 real_seed=-207737814\n",
      "1qys_0001.pdb  1qys_0002.pdb  score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/relax.default.linuxgccrelease -in:file:s input_files/from_rcsb/1qys.pdb @flag_input_relax | grep 'RNG device' -\n",
    "    !ls 1qys_000*.pdb score.sc\n",
    "    !rm 1qys_000*.pdb score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在同一个系统上的使用相同的种子将会生成相同的轨迹和输出.`-run:constant_seed`可以让种子为常数,rosetta默认的种子为1111111.\n",
    "\n",
    "`-run:jran`选项可以指定常数种子,例如12345678:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "basic.random.init_random_generator: Constant seed mode, seed=12345678 seed_offset=0 real_seed=12345678\n",
      "1qys_0001.pdb  1qys_0002.pdb  score.sc\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/relax.default.linuxgccrelease -in:file:s input_files/1qys.pdb -run:constant_seed -run:jran 12345678 @flag_input_relax | grep 'Constant seed mode' -\n",
    "    !ls 1qys_000*.pdb score.sc\n",
    "    !rm 1qys_000*.pdb score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 在Pymol中几乎实时地可视化\n",
    "\n",
    "观察rosetta如何动态调整生物分子是有用的功能.\n",
    "\n",
    "rosetta内部实现了与pymol交互的方法.运行以下命令在打开的pymol中连接rosetta:\n",
    "\n",
    "<p style=\"background:#3e9b76;color:#FFFFFF\">run $CONDA_PREFIX/lib/python3.11/site-packages/pyrosetta/PyMOLRosettaServer.py</p>\n",
    "\n",
    "如果仅在源代码中编译了pyrosetta并没有指定安装位置,则可能位置为`$ROSETTAHOME/source/src/python/bindings/PyMOLRosettaServer.py`.\n",
    "\n",
    "将会输出:`PyMOL <---> PyRosetta link started!`.\n",
    "\n",
    "本文使用ipymol在jupyter notebook中与pymol交互:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Detected OpenGL version 4.6. Shaders available.\n",
      " Detected GLSL version 4.60.\n",
      " Color: defined table 'pymol'.\n",
      "xml-rpc server running on host localhost, port 9123\n",
      "PyMOL <---> PyRosetta link started!\n",
      "at 127.0.0.1 port 65000\n",
      " Color: defined table 'pymol'.\n"
     ]
    }
   ],
   "source": [
    "from note_utils.pymol import restart_pymol\n",
    "\n",
    "viewer=restart_pymol(quiet='q',run=f'$CONDA_PREFIX/lib/python3.11/site-packages/pyrosetta/PyMOLRosettaServer.py')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用`-show_simulation_in_pymol 更新间隔秒数`在pymol中定期更新分子状态,默认间隔为5s,根据需求更改.\n",
    "\n",
    "要保留历史状态,使用`-keep_pymol_simulation_history`.对于生成运行的影像特别有用,但会轻微减慢运行过程.\n",
    "\n",
    "例如,捕获`relax`优化过程中的构象变化,要保留历史状态,每4.5s捕获一次:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前目录从 /home/regen/git_develop/rosetta_notebook/00intro 临时切换到 /home/regen/git_develop/rosetta/demos/tutorials/input_and_output\n",
      "当前目录切换回到 /home/regen/git_develop/rosetta_notebook/00intro\n"
     ]
    }
   ],
   "source": [
    "with chdir(tutorial_path):\n",
    "    !$ROSETTA3/bin/relax.default.linuxgccrelease -in:file:s input_files/from_rcsb/1qys.pdb -show_simulation_in_pymol 4.5 -keep_pymol_simulation_history @flag_input_relax > /dev/null # 输出类似,禁用输出\n",
    "    !rm 1qys*.pdb score.sc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以实时查看relax对蛋白的优化过程,并保存到state中;然后即可在pymol图形化界面下进行保存视频,编辑动画等操作.\n",
    "\n",
    "`-update_pymol_on_energy_changes_only`和`-update_pymol_on_conformation_changes_only`则可以指定只在能量发生变化或者只在构象发生变化时更新状态.\n",
    "\n",
    "#### 覆盖之前生成的输出\n",
    "\n",
    "如果输出目录下已经有输出结构文件,将报错:**protocols.jd2.JobDistributor: no jobs were attempted, did you forget to pass -overwrite?**.\n",
    "\n",
    "如果要覆盖输出,使用`-overwrite`选项,否则更换存放位置.\n",
    "\n",
    "如果输出目录下有分数文件,`-overwrite`选项依然在该文件末尾追加分数.每次运行后分数文件必须手动移动或删除,除非你想要保存在同一个分数文件中.\n",
    "\n",
    "#### 输出的其他选项\n",
    "\n",
    "参见[完整选项列表](../01protocols/00_full_options_list.md)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "viewer.stop()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
